/* class for circular masses
 * inherits basic physics from MassObject
 */

#ifndef CIRCLEMASS_H
#define CIRCLEMASS_H

#include <list>

#include "Definitions.h"
#include "Vector2D.h"
#include "Definitions.h"

namespace ms {
	class CircleMass
	{
		public:
			CircleMass(std::list<CircleMass> * masterListPtr_, real x_= 0, real y_ = 0, real radius_ = 1, real mass_ = 1, real vx_ = 0, real vy_ = 0);
			real radius;
			Vector2D position;
			Vector2D lastPosition; // position before most recent update
			real mass;
			Vector2D velocity;
			Vector2D velocityBeforeCollision; // the velocity just before collision calculations (and the velocity changes due to momentum)
			real distSqr (Vector2D v1, Vector2D v2); // returns the square of the distance between vector positions v1 and v2
			Vector2D getVelocity();

			void updateTerms(real timeScale); // updates the velocity and forces acting on the mass, based on the location of other massses
			void updateLocation(real timeScale, bool collision); // acts on the terms determined in updateTerms
			void solveForCollision();

		private:
			std::list<CircleMass> * masterListPtr; // pointer
			Vector2D sumOfForces; // sum of the fores on this mass
			// TODO: handle collision
	};
}


#endif
